home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
comms_w
/
wrcpdl14.zip
/
RCPDLL.DOC
< prev
next >
Wrap
Text File
|
1995-01-17
|
12KB
|
289 lines
Winsock RCP.DLL Version 1.4
Copyright 1994 Denicomp Systems
All rights reserved
DESCRIPTION
-----------
Winsock RCP.DLL is a Microsoft Windows 3.1 Dynamic Link Library that
provides a Windows Sockets compatible function that allows you to copy files
over TCP/IP. You can copy files from a Windows PC to a remote host, from
the remote host to your PC, or between two remote hosts.
Winsock RCP.DLL provides most of the services of the "rcp" command found
on many Unix systems, including recursive copies. It also includes the
ability to convert text files to the appropriate format for Unix or MS-DOS.
The remote host must be a system running the rshd server process
(i.e. a Unix system). You cannot copy files to another PC, for example.
REQUIREMENTS
------------
Winsock RCP.DLL requires a PC running Windows 3.1 or higher, a Windows
Sockets compatible TCP/IP stack, and any programming language that supports
calls to DLL functions, such as C or Visual Basic.
=============================================================================
FUNCTION: WinsockRCP
Syntax:
-------
C:
int FAR PASCAL WinsockRCP (hwndParent, Title, Src, Dest, RecurFlag, AsciiFlag)
HWND hwndParent;
LPSTR Title;
LPSTR Src;
LPSTR Dest;
int RecurFlag;
int AsciiFlag;
Visual Basic:
Declare Function WinsockRCP Lib "RCP.DLL"
(ByVal hWndParent As Integer,
ByVal Title As String,
ByVal Src As String,
ByVal Dest As String,
ByVal RecursiveFlag As Integer,
ByVal AsciiFlag As Integer) As Integer
Usage:
------
The WinsockRCP function copies the Source to the Destination. The
Source and Destinations are file specifications that can include a
user name, a host name, and a file name, which may include wildcard
characters, such as * and ?.
Parameters:
-----------
hwndParent: The HWND of a window in your application. The WinsockRCP
function may produce diagnostic error messages using the
Windows MessageBox function. This is used to specify the
"parent" window to the MessageBox function. It may be NULL.
Title: The title of your application or some other title. If any
diagnostic error messages are displayed using the Windows
MessageBox function, this will be used as the title of the
message box.
Src: The file or directory to copy. See below for the format.
Dest: The destination of the file(s). See below for the format.
RecurFlag: Specifies whether or not the copy should be recursive. Use
a value of 0 if it is not recursive or 1 if it is. A recursive
copy copies entire directory trees.
AsciiFlag: Specifies whether or not the copy should convert the file
to the proper text file format. If the file is being copied
TO a remote host, CR/NL (ASCII 13/10) combinations are replaced
with one NL (ASCII 10). If the file is being copied FROM a
remote host, NL's are replaced by CR/NL combinations.
Use a value of 0 if the files are not to be converted or
a value of 1 if they are to be converted.
Source and Dest Specifications
------------------------------
Both the Source and Dest parameters must be of the following format:
[[User@][Host:]]{File | Dir}
User@ (optional) Specifies the user name to be used at the remote
host. If this prefixes the Host: parameter, this user name
overrides the user name of the PC.
Host: Specifies the host name of the remote host. This is not
required if the file or directory referenced is on the PC.
This host must be a system running the rshd server process.
That is, you cannot use the host name of another PC running
Windows or MS-DOS.
File Specifies the file name of the source or destination file. You
may use wildcard characters to copy multiple source files. You
may also specify multiple source files individually by separating
the names with spaces.
Dir Specifies the file name of the source or destination directory.
The source may be a directory only if you are using the recursive
copy option. The destination must be a directory if you are
copying multiple files or copying recursively.
Return Value:
-------------
If WinsockRCP sucessfully copies all specified files, it will return zero.
If WinsockRCP is not successful, it will return -1. Note that if multiple
files are to be copied, it will return -1 if an error occurs on any of the
files. WinsockRCP may have successfully copied files prior to the error
and depending on the problem, may continue to copy the remaining files.
Notes:
------
A Host: must be specified for either the Source or Dest parameters, or
both. You cannot use WinsockRCP to copy files locally; you will receive
an error if you try.
Do not use the Host: parameter when referencing local files; this will
not work.
The local user name is determined by first looking in the file WIN.INI
in the Windows directory. If this file contains a section named "[RCP]"
and contains an entry named "User" in that section, the name specified
there will be used as the local user name. For example, WIN.INI would
contain:
[RCP]
User=joe
If this appeared in WIN.INI, the local user name would be "joe" and
WinsockRCP would use this name at the remote host.
If this section does not appear in WIN.INI, WinsockRCP uses the Computer
Name specified in the Windows for Workgroups Network Setup (found on the
Control Panel). This name is converted to lowercase characters and
WinsockRCP uses this name at the remote host. Therefore, if no user name is
specified in WIN.INI, the Computer Name of the PC must be set up as a
valid user on the remote host, in addition to being included in the
remote host's /etc/hosts.equiv file.
(If you are not using Windows for Workgroups and your network does not
provide the services that Windows for Workgroups provides, you must use
WIN.INI to specify the user name or always use the User@ parameter.)
If a full directory path is not specified for a remote host, the path
begins at the user's home directory. That is, if the file/directory
name specified after the Host: parameter does not begin with a slash (/),
it is assumed to reference a file/directory in the user's home directory.
For example, the file "joe@remhost:file.txt" refers to the file "file.txt"
in the home directory of the user "joe" on the host "remhost".
Filenames may contain either slashes (/) or backslashes (\) as directory
separators, for either the host file/directory or file/directories on the
PC. They will be converted to the appropriate separator.
You can copy multiple files by using wildcard characters, such as * or ?.
The Source and Dest parameters may include only ONE file specification
each. That is, you CANNOT specify multiple source files by separating
them with spaces as you can with the "rcp" command. To copy multiple
individual filenames (that cannot be specified using wildcards or using
a recursive copy), you must call WinsockRCP for each file.
If you copy multiple source files with wildcard characters, the destination
the destination must be a directory.
Note that a colon (:) terminates the host name. This causes a problem
when filenames on the PC require a drive letter (e.g. A:). If a file
name specification begins with one character between A and Z and is
followed by a colon (:), WinsockRCP will interpret this as a drive letter
instead of a host name. This means that WinsockRCP cannot handle one
character host names.
The destination cannot contain only a drive specification (e.g. A:). It
must also include a filename or a directory name. If the destination is
the current directory on the drive, use "." (e.g. A:.).
Using the ASCII conversion option to transfer files TO the remote host will
slow the operation of Winsock RCP.DLL somewhat because it must read each
file twice. It reads the file once to calculate the new translated file
size, then reads it again to transfer the data. This is because the RCP
protocol requires that the exact file size be transmitted before the actual
data in the file is sent. Without the conversion option, the file size can
be found by examining the file's directory entry, but with the conversion
option, the file's contents must be examined to determine the size after
CR/NL combinations are replaced with NL.
The ASCII conversion option will also slow Winsock RCP when when
transferring files FROM the remote host, but only slightly.
If transmission speed is critical, consider using utilties to translate the
text files after they are transferred.
SECURITY
--------
The local user name determines the file access privileges WinsockRCP
uses at that remote host. This name also determines the ownership and
access modes of the destination file or files. The remote host allows
access if one of the following conditions is satisfied:
* The name of the local host is listed as an equivalent host in the
/etc/hosts.equiv file on the remote host.
The method of specifying the local host name is determined by the
particular TCP/IP stack you are using.
* If the local host is not in the /etc/hosts.equiv file, the user's home
directory on the remote host must contain a .rhosts file that lists the
local host and local user name.
* The user's login on the remote host does not require a password.
The .rhosts file in the user's home directory must be owned by either
the user specified or "root", and only the owner should have read and write
access.
EXAMPLE
-------
For a full working example of the WinsockRCP function in C, see the CRCP
program included in the distribution.
For a full working example of the WinsockRCP function in Visual Basic,
see the VRCP program included in the distribution. This is the source
to the Visual RCP program included with Winsock RCP and RSH.
// This example copies the file "system.doc" in the user tom's home
// directory on the host "remhost" to the directory "\doc" on the PC
int result;
LPSTR rtitle = "Winsock RCP DLL Sample";
LPSTR src = "tom@remhost:system.doc"
LPSTR dest = "\\doc"
result = WinsockRCP(hWndMain,rtitle,src,dest,0,0);
if (result < 0)
MessageBox(hWndMain,Remote Copy Was Not Successful",rtitle,MB_OK);
else
MessageBox(hWndMain,Remote Copy Was Successful",rtitle,MB_OK);
SUPPORT
-------
Support is available via U.S. Mail and Compuserve/Internet:
Denicomp Systems
P.O. Box 731
Exton, PA 19341
Compuserve: 71612,2333
Internet: 71612.2333@compuserve.com